/* 
 * File:   avdtech.h
 * Author: aishwarya
 *
 * Created on March 12, 2011, 6:02 AM
 */

#ifndef AVDTECH_H
#define	AVDTECH_H

#ifdef	__cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>

#define LOG_FATAL    (1)
#define LOG_ERR      (2)
#define LOG_WARN     (3)
#define LOG_INFO     (4)
#define LOG_DBG      (5)

#ifdef DEBUG    
#define LOG(level, ...) do {  \
                            if (level <= debug_level) { \
                                fprintf(dbgstream,"%s:%d:", __FILE__, __LINE__); \
                                fprintf(dbgstream, __VA_ARGS__); \
                                fprintf(dbgstream, "\n"); \
                                fflush(dbgstream); \
                            } \
                        } while (0)
#else
#define LOG(level, ...)    
#endif /* DEBUG */
    extern FILE *dbgstream;
    extern int debug_level;

#define MAX_INT  2147483647
#define MIN_INT -2147483648

    typedef unsigned int UINT;

    /* User defined functions to compare, print, copy, delete the data of
     * nodes of various data structures */

    typedef int (*KEYCMP) (const void *a, const void *b);
    typedef void (*DATACPY) (void *dst, const void *src);
    typedef void (*DELNODE) (void *n);
    typedef void (*PRINTNODE) (const void *n);

#ifdef	__cplusplus
}
#endif

#endif	/* AVDTECH_H */

